﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Car car = new Car();

            //值参数
            double km = 90.5;

            Console.WriteLine(km);
            Console.WriteLine(car.Speed(km));
            Console.WriteLine(km);


            //引用型参数 特点：加上ref的参数会影响到外面的参数的值
            double km1 = 90.5;

            Console.WriteLine(km1);
            Console.WriteLine(car.Speed1(ref km1));//调用方法的时候变量km1值发生改变
            Console.WriteLine(km1);


            string color = "白色";

            Console.WriteLine(color);
            car.Buy(ref color);
            Console.WriteLine(color);



            //同值参数类型中的string引用类型相比
            //字符串创建之后不能更改长度大小，字符串的连接是重新分配了内存并指向他
            //指向原本的字符串的内存地址
            string s = "abc";

            Console.WriteLine(s);
            Wsa(s);
            Console.WriteLine(s);


            //输出型参数

            var r = car.Run(out int i);
            Console.WriteLine(r);
        }
        public static void Wsa(string s)
        {
            s += "efg";

        }
    }
}
